package user;

import java.util.Scanner;

/**
 * @classname:UserTest2
 * @description:
 * @author: Mr.Z
 * @date: 2020/12/1 21:59
 * @version: 0.1
 * @since:1.8
 */
public class UserTest2 {
    public static void main(String[] args) {
        Permission[] permissions = new Permission[4];
        Scanner input = new Scanner(System.in);
        for (int i = 0; i < 4; i++) {
            System.out.println("请输入1");
            String url = input.next();
            System.out.println("请输入1");
            String remark = input.next();
            permissions[i] = new Permission((i + 1), url, remark);
        }

        Role[] roles = new Role[2];
        Role role1 = new Role(1001, "管理员");
        role1.permissions = new Permission[]{permissions[0], permissions[1], permissions[2]};
        Role role2 = new Role(1002, "超级管理员 ");
        role2.permissions = permissions;
        roles[0] = role1;
        roles[1] = role2;


        User user = new User(1, "admin");
        user.role = new Role(1001, "傻逼管理员");

        for (Role role : roles) {
            if (user.role.id == role.id) {
                Permission[] permission1 = role.permissions;
                for (Permission permission : permission1) {
                    System.out.println("权限" + permission.url + permission.remark);

                }

            }

        }

    }

}
